home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / Z4Z5NDX.C < prev    next >
C/C++ Source or Header  |  1993-07-02  |  2KB  |  79 lines

  1. //----------------------------------------------------------------------------
  2. //                            MODULE DESCRIPTION
  3. //
  4. //  Module:    z4z5ndx.c
  5. //   Title:    ZIP+4 Engine
  6. //  Notice:    John M. Weeder
  7. //                 Copyright (c) 1993. All rights reserved.
  8. //             This module contains proprietary information and should be 
  9. //                treated as confidential.
  10. //
  11. //----------------------------------------------------------------------------
  12. //                           MAINTENANCE HISTORY
  13. //
  14. // $Workfile$
  15. // $Revision$
  16. //   $Author$
  17. //     $Date$
  18. //      $Log$    
  19. //
  20. //----------------------------------------------------------------------------
  21. //                             MODULE NARRATIVE
  22. //
  23. //
  24. //    This module contains code to index the ZIP5 file.
  25. //
  26. //    The code in this module should be written entirely in C. 
  27. //    Do not use any C++ constructs.
  28. //
  29. //    This module is portable to:
  30. //        DOS 3.X+
  31. //        MS Windows 3.X+
  32. //        OS/2 2.X+
  33. //        OS/2 2.0 PM
  34. //        SCO UNIX.
  35. //
  36. //    The following compilers are supported:
  37. //        MSC 6.0A
  38. //        MSC/C++ 7.0
  39. //        Borland C++ 3.1 for DOS
  40. //        Borland C++ 1.0 for OS/2 2.X
  41. //        SCO UNIX cc
  42. //
  43. //----------------------------------------------------------------------------
  44. #include <z4.h>
  45.  
  46.  
  47. //----------------------------------------------------------------------------
  48. //   Description:    Indexing function for ZIP5 file.
  49. //                          The index is the 3 byte BCD encoded ZIP5
  50. //    Parameters:    pdi_index    Indexing data
  51. //       Returns:    TRUE if successful.    
  52. //----------------------------------------------------------------------------
  53. BOOL FN_E Z4Z5Index(PDI_INDEX pdi_index)
  54. {
  55. static Z4_Z5_BLK z5_blk;
  56. static Z4_Z5 z5;
  57.  
  58.     switch (pdi_index->lBlock)
  59.         {
  60.         case ISAM_START:
  61.             Assert(MAX_ZIP5_BCD == MAX_Z5_KEY);
  62.             return Z4Z5ExpandInitialize(&z5_blk);
  63.  
  64.         case ISAM_END:
  65.             return Z4Z5ExpandTerminate(&z5_blk);
  66.         }
  67.                                                     // Reset and expand first record
  68.     Z4Z5ExpandReset(&z5_blk, pdi_index->pbBlock, pdi_index->cbBlock);        
  69.     if (!Z4Z5Expand(&z5_blk, &z5))
  70.         return FALSE;
  71.                                                     // Create key
  72.     Z4Z5Key(pdi_index->pbKey, z5.szZip5);
  73.     pdi_index->cbKey = MAX_Z5_KEY;
  74.     return TRUE;
  75. }
  76. //----------------------------------------------------------------------------
  77. //------------------------------- End of File --------------------------------
  78. //----------------------------------------------------------------------------
  79.